package com.ideacome.test.service;

import com.ideacome.test.common.mock.config.annotation.EnableMocking;
import com.ideacome.test.common.mock.interceptor.MockingConfigurerSupport;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.core.RedisTemplate;

//@Configuration
//@EnableMocking
public class MockingConfig extends MockingConfigurerSupport {

    @Override
    public boolean needMock() {
        return true;
    }

    @Override
    public String keyPrefix() {
        return "spring-test:mock1";
    }


    /**
     * 声明缓存管理器
     *
     * @param redisTemplate
     * @return
     */
    @Bean
    public CacheManager cacheManager(RedisTemplate redisTemplate) {
        return new RedisCacheManager(redisTemplate);
    }
}
